<template>
  <cfgForm :ref="ref" v-bind="attrs" :data="data.values" @change="change"></cfgForm>
</template>

<script>
const ref = "createView";
export default {
  name: ref,
  components: {},
  inject: ["anc"],
  data() {
    return {
      ref,
    };
  },
  props: {
    data: {
      default: () => {
        return {};
      },
    },
  },
  watch: {},
  computed: {
    attrs() {
      return {
        labelWidth: 100,
        labelPosition: "right",
        cols: 2,
        onlyRead: false,
        columns: [
          {
            key: "orderNo",
            title: "订单号",
            config: { type: "text" },
          },
          {
            key: "productId",
            title: "产物规格ID",
            config: { type: "select", options: this.anc.productOptions },
          },
          {
            key: "batchNo",
            title: "批次号",
            config: { type: "text" },
          },
          {
            key: "status",
            title: "状态",
            config: {
              type: "select",
              options: [{ label: "启用", value: "启用" }],
            },
          },
          // {
          //   key: "routingId",
          //   title: "工艺路径",
          //   minWidth: 100,
          //   align: "center",
          //   config: { type: 'number' },
          // },
          {
            key: "statusD",
            title: "代加工标识",
            config: { type: "number" },
          },
          // {
          //   key: "orderFrom",
          //   title: "订单标识",
          //   minWidth: 100,
          //   align: "center",
          //   config: { type: 'text' },
          // },
          {
            key: "weight",
            title: "重量(T)",
            config: { type: "number" },
          },
          {
            key: "maxFSSS",
            title: "最大FSSS",
            config: { type: "number" },
          },
          {
            key: "minFSSS",
            title: "最小FSSS",
            config: { type: "number" },
          },
          {
            key: "maxCT",
            title: "最大CT",
            config: { type: "number" },
          },
          {
            key: "minCT",
            title: "最小CT",
            config: { type: "number" },
          },
          {
            key: "FSSS",
            title: "平均FSSS",
            config: { type: "number" },
          },

          {
            key: "deliveryDate",
            title: "交货日期",
            config: { type: "datetime" },
          },

          {
            key: "supplyStandard",
            title: "供货标准",
            config: { type: "text" },
          },
          {
            key: "packingRequirement",
            title: "包装要求",
            config: { type: "text" },
          },
          {
            key: "customerInformation",
            title: "客户信息",
            config: { type: "text" },
          },
          {
            key: "remark",
            title: "备注",
            line:true,
            config: { type: "textarea" },
          },
        ],
        rules: {
          weight: [
            {
              required: true,
              message: "请输入",
              trigger: "blur",
              type: "number",
            },
          ],
          status:[
            {
              required: true,
              message: "请选择",
              trigger: "change",
            },
          ]
        },
      };
    },
  },
  created() {},
  mounted() {
    this.$nextTick(() => {
      this.$set(this.anc.vms, this.ref, this);
    });
  },
  methods: {
    validate(fn) {
      return this.$refs[this.ref].$refs["form"].validate((valid) => {
        if (fn) {
          return fn(valid);
        } else {
          return valid;
        }
      });
    },
    resetFields() {
      this.$refs[this.ref].$refs["form"].resetFields();
    },
    change(){}
  },
};
</script>
<style scoped></style>
